import java.util.Scanner;

public class TestDay34 {

    //收件人列表
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            int n = scanner.nextInt();
            scanner.nextLine();
            StringBuilder stringBuilder = new StringBuilder();
            for (int i = 0; i < n; i++) {
                String str = scanner.nextLine();
                if(str.contains(" ") || str.contains(",")){
                    //如果包含这两个其中一个
                    char c1 = '"';
                    stringBuilder.append(c1);
                    stringBuilder.append(str);
                    stringBuilder.append(c1);
                }else {
                    //如果不包含
                    stringBuilder.append(str);
                }
                if(i+1 != n)
                    stringBuilder.append(", ");
            }
            System.out.println(stringBuilder);
            //最后输出的是由逗号和空格隔开的,如果名字中包含空格或者逗号,那就用双引号包裹

        }

    }

}
